package zuoye;

import java.util.Scanner;

public class Day3 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.print("选择：");
        String role1 = input.next();

        FightAble f1 = Player.select(role1);
        f1.specialFight();
        f1.commonFight();

        System.out.println("====================");

        System.out.print("选择：");
        String role2 = input.next();

        FightAble f2 = Player.select(role2);
        f2.specialFight();
        f2.commonFight();

        input.close();
    }
}
interface FightAble{
    void specialFight();
    default void commonFight(){
        System.out.println("普通攻击");
    }
}
class Soldier implements FightAble{

    @Override
    public void specialFight() {
        System.out.println("武器攻击");
    }

}
class Mage implements FightAble{

    @Override
    public void specialFight() {
        System.out.println("法术攻击");
    }

}
class Player{

    public static FightAble select(String str){
        if("法力角色".equals(str)){
            return new Mage();
        }else if("武力角色".equals(str)){
            return new Soldier();
        }
        return null;
    }
}